package com.logic;

import cn.hutool.extra.spring.EnableSpringUtil;
import com.logic.comment.lock.lock2.EnableDistributedLock;
import com.logic.config.netty.NettyServer;
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement;

@ComponentScan("com.logic.*.*")
@ComponentScan("com.logic.*.*.*")
@ComponentScan("com.logic.config.*")
@ServletComponentScan   // 扫描过滤器
@SpringBootApplication
@EnableTransactionManagement
@EnableAspectJAutoProxy(exposeProxy = true)
@EnableSpringUtil
@EnableScheduling //启动定时任务
@EnableDubbo
@EnableDistributedLock
public class LogicApplication implements CommandLineRunner {
    @Value(value = "${server.netty.webSocket.port}")
    private int webSocketPort;

    public static void main(String[] args) {
        SpringApplication.run(LogicApplication.class, args);
    }

    // 启动netty
    @Override
    public void run(String... args){
        NettyServer nettyServer = new NettyServer();
        nettyServer.startWebSocketServer(webSocketPort);
    }


}
